<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'tce.label', default: 'Tce')}" />
        <title><g:message code="default.show.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="body">
            <div class="cabelistlateral"><img src="${resource(dir:'images',file:'seta_cabecalho_20x20.png')}" /> Pagamentos</div><br/>
            <div class="dialog dadospessoais">
                <g:if test="${flash.message}">
                    <div class="message">${flash.message}</div>
                </g:if>
                <table>
                  <tbody>
                    <form method="post" action="${createLink(controller:'tcePagamento', action:'buscarTce')}">
                      <tr class="prop">
                        <td class="name">Nº TCE</td>
                        <td><input type="text" name="numtce" value="${tceInstance?.id}"/></td>
                        <td class="btsalvarcadastro" style="padding:0px;"><input type="submit" name="buscar" value="BUSCAR"/></td>
                      </tr>
                    </form>
                  </tbody>
                </table>
                <%
                if(tceInstance && abre=='S'){
                    %>
                    <table>
                        <tbody>
                            <%
                            cor = "concluido";
                            msg = "Concluído"
                            if(tceInstance?.situacao == "0"){
                                cor = "aguardando";
                                msg = "Aguardando"
                            }
                            if(tceInstance?.situacao == "1" && tceInstance.dtFim.after(new Date())){
                                cor = "gerado";
                                msg = "Em andamento"
                            }
                            if(tceInstance?.dtRescisao){
                                cor = "rescindido";
                                msg = "Rescindido"
                            }
                            %>
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.situacao.label" default="Situação" /></td>
                                <td class="${cor}">${msg}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.sequencia.label" default="Sequencia" /></td>
                                <td class="value">${fieldValue(bean: tceInstance, field: "sequencia")}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.dtInicio.label" default="Data Início" /></td>
                                <td class="value"><g:formatDate date="${tceInstance?.dtInicio}" format="dd-MM-yyyy" /></td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.dtFim.label" default="Data Fim" /></td>
                                <td class="value"><g:formatDate date="${tceInstance?.dtFim}" format="dd-MM-yyyy" /></td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.instituicaoEnsino.label" default="Instituição Ensino" /></td>
                                <td class="value">${tceInstance?.instituicaoEnsino?.nome}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.curso.label" default="Curso" /></td>
                                <td class="value">${tceInstance?.curso?.descricao}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.supNome.label" default="Nome Supervisor" /></td>
                                <td class="value">${fieldValue(bean: tceInstance, field: "supNome")}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.supCpf.label" default="CPF Supervisor" /></td>
                                <td class="value">${fieldValue(bean: tceInstance, field: "supCpf")}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.atividades.label" default="Atividades" /></td>
                                <td class="value">${fieldValue(bean: tceInstance, field: "atividades")}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.chSemanal.label" default="Carga Horária Semanal" /></td>
                                <td class="value">${fieldValue(bean: tceInstance, field: "chSemanal")}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.seguradora.label" default="Seguradora" /></td>
                                <td class="value">${fieldValue(bean: tceInstance, field: "seguradora")}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.nroApolice.label" default="Nº Apolice" /></td>
                                <td class="value">${fieldValue(bean: tceInstance, field: "nroApolice")}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.remunera.label" default="Remuneração" /></td>
                                <td class="value">${fieldValue(bean: tceInstance, field: "remunera")}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.dtRescisao.label" default="Data Rescisao" /></td>
                                <td class="value"><g:formatDate date="${tceInstance?.dtRescisao}" /></td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.rescCausa.label" default="Causa Recisão" /></td>
                                <td class="value">${fieldValue(bean: tceInstance, field: "rescCausa")}</td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="tce.obsCausa.label" default="Obs Causa" /></td>
                                <td class="value">${fieldValue(bean: tceInstance, field: "obsCausa")}</td>
                            </tr>

                            <tr>
                              <td></td>
                              <td class="btsalvarcadastro">
                                  <form method="post" action="${createLink(controller:'tce', action:'edit', id:tceInstance?.id)}">
                                      <g:actionSubmit class="edit" action="edit" value="${message(code: 'default.button.edit.label', default: 'Edit')}" />
                                  </form>
                              </td>
                            </tr>
                        </tbody>
                    </table>
                    <%
                }
                %>
            </div>

            <%
            if(tceInstance && abre=='S'){
                %>
                <div class="dadoslateral">
                    <g:include  view="includes/inc_pagamento.gsp" params="[controlador:'tcePagamento', acao:'index']"/>
                </div>
                <%
            }
            %>
        </div>
    </body>
</html>
